package com.csr.csrcheck.controller;

import com.csr.csrcheck.pojo.Abnormal_products;
import com.csr.csrcheck.pojo.Important_notification;
import com.csr.csrcheck.service.Instrument_bulletinService;
import com.csr.csrcheck.service.ex.ClinicException;
import com.csr.csrcheck.util.JsonResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@RequestMapping({"Instrument_bulletin"})
@RestController
public class Instrument_bulletinController extends BaseController {
    private static final Logger log = LoggerFactory.getLogger(com.csr.csrcheck.controller.Instrument_bulletinController.class);

    @Resource
    private Instrument_bulletinService instrument_bulletinService;

    @GetMapping({"Instrument_bulletinlist"})
    public JsonResult<List<Important_notification>> Instrument_bulletinlist(HttpServletResponse response) throws IOException, ServletException {
        List<Important_notification> list = this.instrument_bulletinService.getImportant_notificationlist();
        if (list == null)
            throw new ClinicException("");
        return new JsonResult(Integer.valueOf(0), "json", list);
    }

    @GetMapping({"Abnormal_productslist"})
    public JsonResult<List<Abnormal_products>> Abnormal_productslist(HttpServletResponse response) throws IOException, ServletException {
        List<Abnormal_products> list = this.instrument_bulletinService.getAbnormal_productslist();
        if (list == null)
            throw new ClinicException("");
        return new JsonResult(Integer.valueOf(0), "json", list);
    }
}
